
/*

Author   : chaos

FileName : stl_rev_iter.cpp

Date     : 17/08/17 17:59:33

*/
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
using namespace std;

#define Size 4

template <class  T>
void print(vector<T> & pri_con)
{
    if(pri_con.empty())
        cout << "Container is empty !" << endl;
    else
    {
        typename vector<T>::iterator i;
        for(i = pri_con.begin(); i != pri_con.end(); i++)
        { cout << *i << " "; }
        cout << endl;
    }
}

template <class T>
void rev_print(vector<T> & pri_con)
{
    if(pri_con.empty())
        cout << "Container is empty !" << endl;
    else{

        typename vector<T>::reverse_iterator i;
        for(i = pri_con.rbegin(); i != pri_con.rend(); i++)
        {
            cout << *i << " ";
        }
        cout << endl;
    }

}

int main(int argc ,char *argv[])
{
    vector<int> v;

    v.push_back(1);
    v.push_back(6);
    v.push_back(4);
    cout << "Printing element :" << endl;
    print(v);
    cout << "Printing element by reverse direction : " << endl;
    rev_print(v);

    return 0;

}

